package com.jreque.queue;

import java.util.*;
import java.lang.*;

/**
 * Executes task by calling previously registered function by name.
 */
public class TaskInvocationByName implements ITaskInvocation {
    /**
     * Registered function name.
     */
    private String executorName;

    /**
     * @param executorName Registered function name.
     */
    public TaskInvocationByName(String executorName) {
        this.executorName = executorName;
    }

    /**
     * Invokes task execution by calling registered function by name.
     * @param arguments List of arguments to be passed to execution invocation.
     */
    public void invoke(ArrayList arguments) {
        ObjectMethodDescriptor omd = NamedFunctionRegister.getInstance().lookUp(executorName);
        omd.invoke(arguments);
    }
}

